home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / ACORNUSERS / CBSA / EDUCATION / SAVER / cc / WimpPoll < prev    next >
Text File  |  1997-12-20  |  2KB  |  71 lines

  1.  
  2. //-----------------------------------
  3. //             WimpPoll.c
  4. //-----------------------------------
  5.  
  6.  
  7. #include <stddef.h>                   // NULL definition
  8. #include <os.h>
  9. #include <trap.h>
  10. #include "WimpError.h"
  11. #include "WimpPoll.h"
  12.  
  13.  
  14. WimpPoll::WimpPoll()
  15. {
  16.   mask_event = 0xE1831;
  17. }
  18.  
  19. WimpPoll::~WimpPoll()
  20. {
  21. }
  22.  
  23. void WimpPoll::EnableEvent(Events e)
  24. {
  25.   mask_event &= !(1 << e);
  26. }
  27.  
  28. void WimpPoll::DisableEvent(Events e)
  29. {
  30.   mask_event |= (1 << e);
  31. }
  32.  
  33. void WimpPoll::run()
  34. {
  35.   int r[10];
  36.   os_error *e;
  37.   bool quit = 0;
  38.   
  39.   while (!quit)
  40.   {
  41.     r[0] = mask_event;
  42.     r[1] = (int) block;
  43.     if ((e = os_swi(Wimp_Poll, r)) != NULL) throw (e);
  44.     
  45.     switch (r[0])
  46.     {
  47.       case ENULL :     quit = NullEvent(); break;
  48.       case EREDRAW :     quit = RedrawWindow(); break;
  49.       case EOPEN:    quit = OpenWindow(); break;
  50.       case ECLOSE:    quit = CloseWindow(); break;
  51.       case EPTRLEAVE:    quit = PointerLeave(); break;
  52.       case EPTRENTER:   quit = PointerEnter(); break;
  53.       case EBUT:    quit = ButtonPressed(); break;
  54.       case EUSERDRAG:    quit = UserDrag(); break;
  55.       case EKEY:        quit = KeyPressed(); break;
  56.       case EMENU:    quit = MenuSelected(); break;
  57.       case ESCROLL:    quit = Scrolled(); break;
  58.       case ELOSECARET:    quit = LoseCaret(); break;
  59.       case EGAINCARET:    quit = GainCaret(); break;
  60.       case EPOLLNONZERO: quit = PollNonZero(); break;
  61.       case ESEND:    quit = SendMsg(); break;
  62.       case ESENDWANTACK: quit = SendMsgAck(); break;
  63.       case EACK:    quit = Acknowledge(); break;
  64.       default:         quit = FALSE; break;
  65.     }
  66.   }
  67. }
  68.  
  69.  
  70.  
  71.